package com.itheima.mapper;

import com.itheima.pojo.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface BrandMapper {
    //查询所有品牌
    @Select("select * from tb_brand")
    @ResultMap("brandResultMap")
    public List<Brand> findAll();
    //新增品牌
    public void insert(Brand brand);
    //根据id删除品牌
    @Select("delete from tb_brand where id=#{id}")
    @ResultMap("brandResultMap")
    public void delete(Integer id);
    //修改品牌
    @Select("update tb_brand set brand_name=#{brandName},company_name=#{companyName},ordered=#{ordered},description=#{description},status=#{status} where id=#{id}")
    @ResultMap("brandResultMap")
    public void update(Brand brand);
    //批量删除
    @ResultMap("brandResultMap")
    public void deletebyids(@Param("idss") int[]idss);
    //分页查询
    @ResultMap("brandResultMap")
    @Select("select * from tb_brand limit #{start},#{size}")
    public List<Brand> findByPage(@Param("start")int start,@Param("size") int size);
    @Select("select count(*) from tb_brand")
    public int findCount();
    //多条件查询
    @ResultMap("brandResultMap")
    public List<Brand> findByCondition(@Param("begin") int begin,@Param("size") int size,@Param("brand") Brand brand);
    //模糊查询
    @ResultMap("brandResultMap")
    public int findCountbycondition(Brand brand);



}
